<?php
namespace app\api\model;

use think\Model;
use think\Db;

class Index extends Model
{
 	public static function getUser($id)
    {
       	// $result=Db::query('select * from test where id=?',[$id]);
       	$result=Db::query('select * from test');
       	// $result=Db::table('test')->find("*");
		return $result;
    }
    public static function addUser($id)
    {
       	// $result=Db::query('select * from test where id=?',[$id]);
       	// $result=Db::query('select * from test');
       	$data = ['id'=>null,'name' => 'bar','password'=>565656, 'phone' => 123215];
		Db::table('test')->insert($data);
    }
    public static function updateUser($id)
    {
       	// $result=Db::query('select * from test where id=?',[$id]);
       	// $result=Db::query('select * from test');
       	// $data = ['id'=>null,'name' => 'bar','password'=>565656, 'phone' => 123215];
		Db::table('test')->where('id', 1)->update(['name' => 'thinkphp']);
    }
}